#pragma once

using namespace std;

#include "api/GameInfo.h"

typedef unsigned int uint;
typedef unsigned char uchar;
typedef vector<Vector2> Path;


class Utils
{
public:
    static bool IsLOS(const LevelInfo* level, const Vector2& v0, const Vector2& v1, float max_height = 1.f);

    // angle in radians
    static Vector2 Rotate(const Vector2& v, float angle);
};


class MapBuffer
{
public:
    MapBuffer(uint width, uint height, float* data);
    ~MapBuffer() { delete [] m_Data; }

    void Set(uint x, uint y, float value);

    uint GetWidth() const { return m_Width; }
    uint GetHeight() const { return m_Height; }
    float Get(uint x, uint y) const { assert(x < m_Width); assert(y < m_Height); return m_Data[x + y * m_Width]; }

    void Clear(float* data);

private:
    uint m_Width;
    uint m_Height;
    float* m_Data;
};

